<!-- 能力素养 -->
<template>
  <div style="display: flex; flex-direction: column" v-if="tableData">
    <template v-if="tableData.scorerStatus?.appoint.status === 1">
      <div class="item">
        <a-space wrap>
          <div>指定员工：</div>
          <template v-for="item in tableData.scorer" :key="item.id">
            <template v-if="item.type === 1">
              <a-tag color="arcoblue" :default-checked="true">
                {{ item.userName }}({{ item.weight }}%)
              </a-tag>
            </template>
          </template>
        </a-space>

        <div>
          <a-tag color="red" :default-checked="true">
            权重：
            {{ tableData.scorerStatus?.appoint.weight }}%
          </a-tag>
        </div>
      </div>
    </template>
    <template v-if="tableData.scorerStatus?.superiors.status === 1">
      <div class="item">
        <a-space v-if="tableData.scorerStatus?.superiors.status === 1" wrap>
          <div>上级：</div>
          <template v-for="item in tableData.scorer" :key="item.id">
            <template v-if="item.type === 2">
              <a-tag color="arcoblue" :default-checked="true">
                {{ item.userName }}({{ item.weight }}%)
              </a-tag>
            </template>
          </template>
        </a-space>
        <div>
          <a-tag color="red" :default-checked="true">
            权重：
            {{ tableData.scorerStatus?.superiors.weight }}%
          </a-tag>
        </div>
      </div>
    </template>
    <template v-if="tableData.scorerStatus?.peer.status === 1">
      <div class="item">
        <a-space v-if="tableData.scorerStatus?.peer.status === 1" wrap>
          <div>同级：</div>
          <template v-for="item in tableData.scorer" :key="item.id">
            <template v-if="item.type === 3">
              <a-tag color="arcoblue" :default-checked="true">
                {{ item.userName }}({{ item.weight }}%)
              </a-tag>
            </template>
          </template>
        </a-space>
        <div>
          <a-tag color="red" :default-checked="true">
            权重：
            {{ tableData.scorerStatus?.peer.weight }}%
          </a-tag>
        </div>
      </div>
    </template>
    <template v-if="tableData.scorerStatus?.junior.status === 1">
      <div class="item">
        <a-space v-if="tableData.scorerStatus?.junior.status === 1" wrap>
          <div>下级：</div>
          <template v-for="item in tableData.scorer" :key="item.id">
            <template v-if="item.type === 4">
              <a-tag color="arcoblue" :default-checked="true">
                {{ item.userName }}({{ item.weight }}%)
              </a-tag>
            </template>
          </template>
        </a-space>
        <div>
          <a-tag color="red" :default-checked="true">
            权重：
            {{ tableData.scorerStatus?.junior.weight }}%
          </a-tag>
        </div>
      </div>
    </template>
    <template v-if="tableData.scorerStatus?.other.status === 1">
      <div class="item">
        <a-space v-if="tableData.scorerStatus?.other.status === 1" wrap>
          <div>其他：</div>
          <template v-for="item in tableData.scorer" :key="item.id">
            <template v-if="item.type === 6">
              <a-tag color="arcoblue" :default-checked="true">
                {{ item.userName }}({{ item.weight }}%)
              </a-tag>
            </template>
          </template>
        </a-space>
        <div>
          <a-tag color="red" :default-checked="true">
            权重：
            {{ tableData.scorerStatus?.other.weight }}%
          </a-tag>
        </div>
      </div>
    </template>
  </div>
</template>

<script setup lang="ts">
import { PerformanceKeyPerformanceIndexLibraryUse } from '@/apis/management/performance/baseSetting/template/type';
import { useVModel } from '@vueuse/core';
const props = withDefaults(
  defineProps<{
    review?: boolean;
    data?: PerformanceKeyPerformanceIndexLibraryUse;
    upperLimitScore?: number;
  }>(),
  {}
);
const emit = defineEmits(['update:visible', 'handleOk', 'update:data']);
const tableData = useVModel(props, 'data', emit);
</script>

<style lang="less" scoped>
.item {
  display: flex;
  border-bottom: 1px solid #e5e6eb;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
}
.item:last-child {
  border-bottom: none;
}
</style>
